package cn.zhuama.basic.common;

import cn.zhuama.basic.util.AjaxResult;
import cn.zhuama.dto.SmsCodeDto;
import cn.zhuama.org.service.ISmsCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping("/verifyCode")
@RestController
public class SmsCodeController {

    @Autowired
    private ISmsCodeService smsCodeService;
    @PostMapping("/smsCode")
    public AjaxResult smmCode(@RequestBody Map<String,String> map){
        try {
            smsCodeService.regist(map);
            return  AjaxResult.me().setSuccess(true);
        } catch (Exception e) {
            return AjaxResult.me().setSuccess(false).setMessage(e.getMessage());
        }

    }
    @PostMapping("/binderSmsCode")
    public AjaxResult binderSmsCode(@RequestBody Map<String,String> map){
        try {
            smsCodeService.binderSmsCode(map);
            return  AjaxResult.me().setSuccess(true);
        } catch (Exception e) {
            return AjaxResult.me().setSuccess(false).setMessage(e.getMessage());
        }

    }
}
